home *** CD-ROM | disk | FTP | other *** search
- #define CURSES_LIBRARY 1
- #include <curses.h>
-
- #ifndef NDEBUG
- char *rcsid__scr2win = "$Header: k:/tools/src/curses/private/rcs/_scr2win.c 2.1.0.2 93/08/13 10:54:57 frotz Beta2 $";
- #endif
-
-
-
-
- /*man-start*********************************************************************
-
- PDC_cpy_scrn2win() - Copies current screen contents to a window.
-
- PDCurses Description:
- This routine will copy the current contents of the screen (assuming
- that this functionality is available) into the passed window. This
- routine will be called from within initscr() and the private window
- containing the original screen contents will be displayed just prior
- to termination in endwin().
-
- This routine makes use of PDC_get_char_and_attr() and PDC_gotoxy()
- to collect the contents of the screen.
-
- This routine enables color if it is available by calling start_color().
-
- WARNING: This routine uses COLOR_PAIRS-2 as the color
- pair number.
-
- PDCurses Return Value:
- This function returns OK on success, otherwise an ERR is returned.
-
- PDCurses Errors:
- * operation is unsupported by current platform.
-
- * passed window is smaller than current screen size
- though as much of the screen contents are copied to the
- window as possible.
-
- * passing a NULL window pointer.
-
- Portability:
- PDCurses int PDC_cpy_scrn2win( WINDOW* w );
-
- **man-end**********************************************************************/
-
- int PDC_cpy_scrn2win( WINDOW *w )
- {
- #ifdef FLEXOS
- return( ERR );
- #endif
- #ifdef OS2
- return( ERR ) /* Force an error until an OS/2 developer can verify */
- #endif
- #ifdef DOS
- int lines;
- int cols;
- chtype ch;
- chtype bold;
- chtype blinking;
- int foreground;
- int background;
- int x;
- int y;
- bool visible = _cursvar.visible_cursor;
- bool mono = _cursvar.mono;
-
- if (!mono)
- start_color();
-
- if (visible)
- cursoff();
- PDC_get_cursor_pos( &y, &x );
-
- /*
- * Sorry, only monochrome coloring
- * The color at (row,col) is it.
- */
- ch = (chtype)PDC_get_char_and_attr();
- foreground = ((ch >> (8+0)) & 0x000F);
- background = ((ch >> (8+4)) & 0x000F);
- init_pair( COLOR_PAIRS-2, foreground, background );
-
- werase( w );
- for( lines=0; (lines < LINES && lines < w->_maxy); lines++ )
- {
- for( cols=0; (cols < COLS && cols < w->_maxx); cols++ )
- {
- PDC_gotoxy( lines, cols );
- ch = (chtype)PDC_get_char_and_attr();
- ch &= A_CHARTEXT;
- mvwaddch( w, lines, cols, ch );
- }
- }
- wmove( w, y, x );
- if (visible)
- {
- curson();
- mvcur( LINES, COLS, y, x );
- }
- return( OK );
- #endif
- }
-